package com.flurry.android;

import android.content.Context;
import android.view.ViewGroup;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Stack;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;

final class gv
{
  private static String p = "FlurryAgent";
  private final ScheduledExecutorService ai = Executors.newSingleThreadScheduledExecutor();
  private Map<String, fm> jh = new HashMap();
  private Map<String, Stack<WeakReference<v>>> ji = new HashMap();

  final void C(String paramString)
  {
    try
    {
      this.jh.remove(paramString);
      return;
    }
    finally
    {
      localObject = finally;
      throw localObject;
    }
  }

  final v O(String paramString)
  {
    try
    {
      if (this.ji.containsKey(paramString))
      {
        Stack localStack = (Stack)this.ji.get(paramString);
        if (localStack.size() > 0);
        for (localv = (v)((WeakReference)localStack.peek()).get(); ; localv = null)
          return localv;
      }
      v localv = null;
    }
    finally
    {
    }
  }

  final fm P(String paramString)
  {
    try
    {
      fm localfm = (fm)this.jh.remove(paramString);
      return localfm;
    }
    finally
    {
      localObject = finally;
      throw localObject;
    }
  }

  final boolean Q(String paramString)
  {
    try
    {
      boolean bool = this.jh.containsKey(paramString);
      return bool;
    }
    finally
    {
      localObject = finally;
      throw localObject;
    }
  }

  final v a(FlurryAds paramFlurryAds, Context paramContext, ViewGroup paramViewGroup, String paramString)
  {
    try
    {
      v localv = O(paramString);
      if (localv != null)
      {
        boolean bool = localv.getContext().equals(paramContext);
        if (!bool);
      }
      while (true)
      {
        return localv;
        localv = new v(paramFlurryAds, paramContext, paramString, paramViewGroup, this.ai);
        Stack localStack = (Stack)this.ji.get(paramString);
        if (localStack == null)
        {
          localStack = new Stack();
          this.ji.put(paramString, localStack);
        }
        localStack.push(new WeakReference(localv));
      }
    }
    finally
    {
    }
  }

  final void a(String paramString, fm paramfm)
  {
    try
    {
      this.jh.put(paramString, paramfm);
      return;
    }
    finally
    {
      localObject = finally;
      throw localObject;
    }
  }

  final void d(v paramv)
  {
    if (paramv == null);
    while (true)
    {
      return;
      try
      {
        String str = paramv.i();
        Stack localStack = (Stack)this.ji.get(str);
        if (localStack == null)
          continue;
        Iterator localIterator = localStack.iterator();
        while (localIterator.hasNext())
        {
          WeakReference localWeakReference = (WeakReference)localIterator.next();
          if (paramv == localWeakReference.get())
            if (localStack.remove(localWeakReference))
              new StringBuilder().append("removed banner holder for adSpaceName: ").append(paramv.i()).toString();
        }
        if (localStack.size() != 0)
          continue;
        this.ji.remove(str);
      }
      finally
      {
      }
    }
  }

  final List<v> w(Context paramContext)
  {
    ArrayList localArrayList;
    try
    {
      localArrayList = new ArrayList();
      Iterator localIterator1 = this.ji.values().iterator();
      while (localIterator1.hasNext())
      {
        Iterator localIterator2 = ((Stack)localIterator1.next()).iterator();
        while (localIterator2.hasNext())
        {
          v localv = (v)((WeakReference)localIterator2.next()).get();
          if ((localv != null) && ((paramContext == null) || (paramContext == localv.getContext())))
            localArrayList.add(localv);
        }
      }
    }
    finally
    {
    }
    return localArrayList;
  }
}

/* Location:           E:\android\Toy Defense 2_dex2jar.jar
 * Qualified Name:     com.flurry.android.gv
 * JD-Core Version:    0.6.2
 */